#include "lcdtimer.h"

#include <QTimer>
#include <QTime>

LCDTimer::LCDTimer(QWidget *parentWidget) : QLCDNumber(parentWidget)
{
    timer = new QTimer();
    timeValue = new QTime(0,0,0);
    this->setParent(parentWidget);
    this->display(timeValue->toString());
    QObject::connect(timer,SIGNAL(timeout()),this,SLOT(setDisplay()));
}

LCDTimer::~LCDTimer()
{

}

void LCDTimer::setDisplay()
{
    this->timeValue->setHMS(this->timeValue->addSecs(1).hour(),this->timeValue->addSecs(1).minute(),this->timeValue->addSecs(1).second());
    this->display(this->timeValue->toString());
}

void LCDTimer::resetDisplay()
{
    timeValue = new QTime(0,0,0);
    this->display(timeValue->toString());
}

void LCDTimer::stop()
{
    timer->stop();
}
